package com.hbpu.encap.IO;

import java.io.*;

public class Homework02 {
    public static void main(String[] args) throws IOException {
        String path = "E:\\mytemp";
        BufferedReader bufferedReader = new BufferedReader(new FileReader(path + "\\hello.txt"));
        int readLine = 0;
        String line = null;
        while ((line = bufferedReader.readLine()) != null) {
            System.out.println((++readLine) + line + "。");
        }
        bufferedReader.close();

        System.out.println("-------------------------------------------");

        InputStreamReader inputStreamReader = new InputStreamReader(new FileInputStream(path + "\\hello.txt"), "gbk");
        BufferedReader bufferedReader1 = new BufferedReader(inputStreamReader);
        String line1 = null;
        int count = 0;
        while ((line1 = bufferedReader1.readLine()) != null) {
            System.out.println((++count) + line1);
        }

//        try {
//            for (String s : str) {
//                bufferedWriter.write(s);
//                bufferedWriter.newLine();
//            }
//            bufferedWriter.close();
//            System.out.println("句号添加成功！");
//        } catch (IOException e) {
//            System.out.println("添加失败！数组出现错误！" + e.getMessage());
//        }
    }
}

